home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Bus / C / Commander Demo / Commander Demo.rsrc / TEXT_5023_ARRAY POINTER.txt < prev    next >
Encoding:
Text File  |  1993-09-07  |  2.2 KB  |  39 lines

  1. ARRAY¬†POINTER (name; size1; {size2})
  2.                                                                                     Pg 13-2
  3.  
  4. name     Array          Name of the array to create
  5. size1     Number        Number of elements in the array or number of 
  6.                                       rows if size2 is specified
  7. size2     Number        Number of columns in a two dimensional array
  8.  
  9.  
  10. Creates name, an array of type Integer, with size1 number of elements. If specified, name will be a two-dimensional array with size1 columns and size2 rows. If name already exists, the array is resized and elements that are not cropped retain their value.
  11.  
  12. The size2 parameter is optional; if it is specified the commands create two-dimensional arrays. In this case, size1 specifies the number of rows and size2 specifies the number of columns in each array.
  13.  
  14. Each row in a two-dimensional array can be treated like an element.This means that you can insert and delete entire arrays in a two-dimensional array with the other array commands.
  15.  
  16. Creates Name, an array of type Pointer, with Size1 number of elements specified, Name will be a two-dimensional array with Size1 columns and Size2 rows. If Name already exists, the array is resized and elements that are not cropped retain their value.
  17.  
  18.  
  19. An element 0 (array name{0}) is always created for an array, and is set to a null value of the array type. Use the Size¬†of¬†array command to find the size of the array. the following line would delete all elements (except the 0 element), but leave the array defined:
  20.  
  21.      ARRAY¬†POINTER (‚óäMine;0)
  22.  
  23. The following formula shows how to calculate the amount of memory used by a pointer array:
  24.  
  25.           (1+number of elements)*16
  26.  
  27. Note: a few more bytes may be required to keep track of the selected element, the number of elements, and the array itself.
  28.  
  29.  
  30. When a Pointer array is first created, its elements are empty values, that is NIL.
  31.  
  32. You refer to the elements by using curly braces. For example, MyArray{2} refers to the second element in the array MyArray. For two-dimensional arrays you refer to individual elements by using two sets of curly braces. For example, MyArray{3}{5} refers to the third row and fifth column.
  33.  
  34.  
  35.  
  36. See also: Size¬†of¬†array 
  37.  
  38.  
  39.